package com.itheima.demo001;

import java.util.Random;
import java.util.Scanner;

public class exercise24 {
    public static void main(String[] args) {
        /*int count == 0*/
        //猜数字小游戏1~100
        //生成1~100之间的随机数字
        Random r = new Random();
        int number = r.nextInt(100);
        /*System.out.println(number);*/

        //猜数字
        Scanner sc = new Scanner(System.in);
        while(true){
            System.out.println("请猜数字");
            int guessNumber = sc.nextInt();
            /*count++;
            if(count == 360){
                System.out.println("获得了荣耀水晶");
                break;
            }
            */
            if(guessNumber > number){
                System.out.println("大了");
            }else if(guessNumber < number){
                System.out.println("小了");
            }else{
                System.out.println("猜对了！！！");
                break;
            }
        }
//生成随机数字的代码，不可以写在循环里面，否则每次都会产生新的随机数
        /*游戏抽奖，保底机制*/

    }
}
